/*

	This program will run the remaining programs to replicate the figures and 
	tables from Martellini et al. work on college graduate quality.

*/

local seed "C:\Users\jsock\Dropbox\Research\GD\International"

local dataPath "`seed'/Data"
local inputPath "`seed'/InputData"
local figurePath "`seed'/Replication/Figures"
local tablePath "`seed'/Replication/Tables"
local estimatePath "`seed'/Replication/Estimates"
local tempPath "`seed'/Replication/TempData"

global pythonPath "`seed'/Replication/Python"
global stataPath "`seed'/Replication/Stata"

*----------------------------------------------------
* Section C: Intermediate Analysis with the Glassdoor data
*----------------------------------------------------

/*
	A) R_compare_US_graduates.do

		Description: Estimates the degree of selection bias into the Glassdoor dataset for U.S. college graduates employed in the U.S.
		Output:	Figure 1
			Selection_UnitedStates.csv
*/

	do $stataPath/R_compare_US_graduates.do

/*
	B) R_compare_UK_graduates.do

		Description: Estimates the degree of selection bias into the Glassdoor dataset for U.K. college graduates employed in the U.K.
		Output:	Figure C1p
			Selection_UnitedKingdom.csv
*/

	do $stataPath/R_compare_UK_graduates.do

/*
	C) R_compare_Australian_graduates.do

		Description: Estimates the degree of selection bias into the Glassdoor dataset for Australian college graduates employed in Australia
		Output:	Figure C1a
			Selection_Australia.csv
*/

	do $stataPath/R_compare_Australian_graduates.do

/*
	D) R_compare_Nigeria_graduates.do

		Description: Estimates the degree of selection bias into the Glassdoor dataset for Nigerian college graduates employed in Nigeria
		Output:	Figure C1j
			Selection_Nigeria.csv
*/

	do $stataPath/R_compare_Nigeria_graduates.do

/*
	E) R_compare_Japan_graduates.do

		Description: Estimates the degree of selection bias into the Glassdoor dataset for Japanese college graduates employed in Japan
		Output:	Figure C1g
			Selection_Japan.csv
*/

	do $stataPath/R_compare_Japan_graduates.do

/*
	F) R_compare_Colombia_graduates.do

		Description: Estimates the degree of selection bias into the Glassdoor dataset for Colombian college graduates employed in Colombia
		Output:	Figure C1c
			Selection_Colombia.csv
*/

	do $stataPath/R_compare_Colombia_graduates.do
	
/*
	G) R_compare_Poland_graduates.do

		Description: Estimates the degree of selection bias into the Glassdoor dataset for Polish college graduates employed in Poland
		Output:	Figure C1l
			Selection_Poland.csv
*/

	do $stataPath/R_compare_Poland_graduates.do
	
/*
	H) R_compare_Ireland_graduates.do

		Description: Estimates the degree of selection bias into the Glassdoor dataset for Irish college graduates employed in Ireland
		Output:	Figure C1e
			Selection_Ireland.csv
*/

	do $stataPath/R_compare_Ireland_graduates.do
	
/*
	I) R_compare_Singapore_graduates.do

		Description: Estimates the degree of selection bias into the Glassdoor dataset for Singaporean college graduates employed in Singapore
		Output:	Figure C1m
			Selection_Singapore.csv
*/

	do $stataPath/R_compare_Singapore_graduates.do
	
/*
	J) R_compare_India_graduates.do

		Description: Estimates the degree of selection bias into the Glassdoor dataset for Indian college graduates employed in India
		Output:	Figure C1d
			Selection_India.csv
*/

	do $stataPath/R_compare_India_graduates.do
	
/*
	K) R_compare_Philippines_graduates.do

		Description: Estimates the degree of selection bias into the Glassdoor dataset for Philipino college graduates employed in Philippines
		Output:	Figure C1k
			Selection_Philippines.csv
*/

	do $stataPath/R_compare_Philippines_graduates.do
	
/*
	L) R_compare_SouthKorea_graduates.do

		Description: Estimates the degree of selection bias into the Glassdoor dataset for Korean college graduates employed in South Korean
		Output:	Figure C1o
			Selection_SouthKorea.csv
*/

	do $stataPath/R_compare_SouthKorea_graduates.do
	
/*
	M) R_compare_Italian_graduates.do

		Description: Estimates the degree of selection bias into the Glassdoor dataset for Italian college graduates employed in Italy
		Output:	Figure C1f
			Selection_Italy.csv
*/

	do $stataPath/R_compare_Italian_graduates.do
	
/*
	N) R_compare_South_Africa_graduates.do

		Description: Estimates the degree of selection bias into the Glassdoor dataset for South African college graduates employed in South Africa
		Output:	Figure C1n
			Selection_SouthAfrica.csv
*/

	do $stataPath/R_compare_South_Africa_graduates.do
	
/*
	O) R_compare_China_graduates.do

		Description: Estimates the degree of selection bias into the Glassdoor dataset for Chinese college graduates employed in China
		Output:	Figure C1b
			Selection_China.csv
*/

	do $stataPath/R_compare_China_graduates.do
	
/*
	P) R_compare_New_Zealand_graduates.do

		Description: Estimates the degree of selection bias into the Glassdoor dataset for New Zealand college graduates employed in New Zealand
		Output:	Figure C1i
			Selection_NewZealand.csv
*/

	do $stataPath/R_compare_New_Zealand_graduates.do
	
/*
	Q) R_compare_Netherlands_graduates.do

		Description: Estimates the degree of selection bias into the Glassdoor dataset for Netherlands college graduates employed in the Netherlands
		Output:	Figure C1h
			Selection_Netherlands.csv
*/

	do $stataPath/R_compare_Netherlands_graduates.do
	
/*
	R) R_list_keywords_majors_degrees.py

		Description: Produces lists of the majors and degree assignments used for uniformizing resumes that are reported in the Appendix.
		Output: Keywords_MAJOR.txt
			Keywords_DEGREE.txt
*/

	python script $pythonPath/R_list_keywords_majors_degrees.py

*----------------------------------------------------
* Section D: Main Analysis with the Glassdoor data
*----------------------------------------------------

/*
	A) R_regressions_school_quality_domestic.do

		Description: Estimates skill prices for each country and college graduate quality for each college, and then relates college graduate quality to development and notable accomplishments including entrepreneurship and top management, while also estimating the degree to which migrants are selected compared with non-migrants.
		Output:	Table 4 (vertically)
			Table 5
			Table 6
			Table 7
			Table 8
			Table B1
			Table B3
			Table B7
			Figure 2a, 2b
			Figure 3
			Figure 5a, 5b
			Figure 6
			Figure 7a, 7b
			Figure B1
			Figure B2
			Figure B3
			Figure B4
*/

	do $stataPath/R_regressions_school_quality_domestic.do

/*
	B) R_regressions_school_quality_alternative_truncation.do

		Description: Estimates college graduate quality under a different truncation for limiting the influence of low and high pay outliers.
		Output:	Estimates_z_c_altTrunc.dta
			Estimates_q_j_altTrunc.dta
*/

	do $stataPath/R_regressions_school_quality_alternative_truncation.do

/*
	C) R_regressions_school_quality_full_impute.do

		Description: Estimates college graduate quality assuming that workers with only a single college listed but no degree received their bachelor's degree there.
		Output:	Estimates_z_c_imputeMissing.dta
			Estimates_q_j_imputeMissing.dta
*/

	do $stataPath/R_regressions_school_quality_full_impute.do

/*
	D) R_regressions_school_quality_sensitivity.do

		Description: Estimates college graduate quality under alternative modeling assumptions.
		Output:	Table 9 (separately for each ALTERNATIVE)
			Table 10 (vertically)
			Table B2
			Figure B6a
			Figure B6b
			Estimates_z_c_ALTERNATIVE.dta
			Estimates_q_j_ALTERNATIVE.dta
*/

	do $stataPath/R_regressions_school_quality_sensitivity.do

/*
	E) R_college_graduate_quality_distribution_relative_US.py

		Description: Reads in the estimates of college graduate quality and determines where each college would fall in the US distribution of college graduate quality.
		Output: School_q_j_distribution_relative_US.csv
*/

	python script $pythonPath/R_college_graduate_quality_distribution_relative_US.py

/*
	F) R_plot_distributions_relative_to_US_quartiles.do

		Description: Looks at distribution of college graduate quality by country.
		Output:	Figure 4a
			Figure 4b
			Figure 4c
*/

	do $stataPath/R_plot_distributions_relative_to_US_quartiles.do

/*
	G) R_analyze_gpa.do

		Description: Relates undergraduate GPA to earnings.
		Output:	Table B8
*/

	do $stataPath/R_analyze_gpa.do

/*
	H) R_regressions_school_quality_bootstrap.do

		Description: Estimates elasticity of college graduate quality with respect to GDP per worker using a bootstrap approach to estimating z_c (and thus q_j)
		Output:	Figure B5a
			Figure B5b
*/

	do $stataPath/R_regressions_school_quality_bootstrap.do













